package io.github.qifan777.server.rating.entity;

import io.github.qifan777.server.infrastructure.jimmer.BaseEntity;
import io.github.qifan777.server.task.entity.TaskOrder;
import io.qifan.infrastructure.generator.core.*;
import jakarta.annotation.Nullable;
import org.babyfish.jimmer.sql.Entity;
import org.babyfish.jimmer.sql.ManyToOne;
import org.babyfish.jimmer.sql.Serialized;

import java.util.List;

/**
 * 课程评分
 */
@GenEntity
@Entity
public interface Rating extends BaseEntity {
    /**
     * 评分
     */
    @GenNumberField(label = "评分", order = 1)
    int score();

    /**
     * 内容
     */
    @GenTextAreaField(label = "内容", order = 2)
    String content();

    /**
     * 图片
     */
    @GenImageField(label = "图片", order = 3)
    @Serialized
    @Nullable
    List<String> pictures();

    /**
     * 课程订单id
     */
    @GenAssociationField(label = "订单", prop = "orderId")
    @ManyToOne
    TaskOrder order();
}

